<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/taglibs.jsp" %>
<c:choose>
	<c:when test="${param.mail==null}">
<jsp:include page="../common/body-header.jsp"/>
		<h1>${job.identifier.stringIdentifier}</h1>
	</c:when>
	<c:otherwise>
		<h1><a href="${ss:getServerPath(pageContext.request)}/job-result.action?identifier=${job.identifier.stringIdentifier}">${job.identifier.stringIdentifier}</a></h1>
	</c:otherwise>
</c:choose>
		<b>Job Type:</b> ${job.type}<br>
		<b>Job Name:</b> ${conf.name}<br>
<c:if test="${conf.description!=null && fn:length(conf.description)>0}">
		<b>Job Description:</b> ${conf.description}<br>
</c:if>
		<b>Status:</b> ${job.status}<br>
<c:if test="${job.maxRetry>0}">
		<b>Retry:</b> ${job.retry} of ${job.maxRetry}<br>
</c:if>
<c:if test="${job.resource!=null}">
		<b>Resource:</b> ${job.resource}<br>
</c:if>
<c:if test="${job.status=='finish'}">
		<b>Succeed:</b>
<c:choose>
	<c:when test="${param.mail==null}">
		<c:choose>
			<c:when test="${job.succeed}"><img alt="success" src="images/icons/ok.jpg" title="success"></c:when>
			<c:otherwise><img alt="fail" src="images/icons/error.png" title="fail"></c:otherwise>
		</c:choose><br>
	</c:when>
	<c:otherwise>
		<c:choose>
			<c:when test="${job.succeed}"><img alt="success" src="cid:img_ok" title="success"></c:when>
			<c:otherwise><img alt="fail" src="cid:img_error" title="fail"></c:otherwise>
		</c:choose><br>
	</c:otherwise>
</c:choose>
</c:if>
		<b>Submitter:</b> ${job.submitter}<br>
		<b>Submitted at:</b> ${ss:dateFormat(job.submitTime)}<br>
<c:choose>
	<c:when test="${job.status=='submit' || job.status=='ready' || job.status=='queue' || job.status=='pause'}">
		<b>Waiting Time:</b> ${ss:fromNowOn(job.submitTime)}<br>
		<b>Ready:</b> ${job.ready}<br>
	</c:when>
	<c:when test="${job.status=='cancel'}">
		<b>Canceled at:</b> ${ss:dateFormat(job.launchTime)} (${ss:timeBetween(job.launchTime, job.submitTime)})<br>
	</c:when>
	<c:when test="${job.status=='run'}">
		<b>Launched at:</b> ${ss:dateFormat(job.launchTime)} (${ss:timeBetween(job.launchTime, job.submitTime)})<br>
		<b>Running Time:</b> ${ss:fromNowOn(job.submitTime)} (${ss:timeBetween(job.launchTime, job.submitTime)} + ${ss:fromNowOn(job.launchTime)})<br>
	</c:when>
	<c:otherwise>
		<b>Launched at:</b> ${ss:dateFormat(job.launchTime)}<c:if test="${job.launchTime>0}"> (${ss:timeBetween(job.launchTime, job.submitTime)})</c:if><br>
		<b>Finished at:</b> ${ss:dateFormat(job.finishTime)}<c:if test="${job.finishTime>0}"> (${ss:timeBetween(job.launchTime, job.submitTime)} + ${ss:timeBetween(job.finishTime, job.launchTime)} = ${ss:timeBetween(job.finishTime, job.submitTime)})</c:if><br>
	</c:otherwise>
</c:choose>
		<b>Job Configuration Id:</b> <a href="${ss:getServerPath(pageContext.request)}/job-conf.action?action=view&identifier=${conf.identifier.stringIdentifier}">${conf.identifier.stringIdentifier}</a><br>